package io.geekidea.boot.test.controller;

import io.geekidea.boot.framework.page.Paging;
import io.geekidea.boot.framework.response.ApiResult;
import io.geekidea.boot.test.query.AppIssueFeedbackQuery;
import io.geekidea.boot.test.service.IssueFeedbackService;
import io.geekidea.boot.test.vo.AppIssueFeedbackVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * App问题反馈 控制器
 *
 * @author geekidea
 * @since 2025-03-26
 */
@Slf4j
@RestController
@Tag(name = "App问题反馈")
@RequestMapping("/app/issueFeedback")
public class AppIssueFeedbackController {

    @Autowired
    private IssueFeedbackService issueFeedbackService;

    /**
     * 获取App问题反馈详情
     *
     * @param id
     * @return
     * @throws Exception
     */
    @Operation(summary = "获取App问题反馈详情")
    @PostMapping("/getAppIssueFeedback/{id}")
    public ApiResult<AppIssueFeedbackVo> getAppIssueFeedback(@PathVariable Long id) {
        log.info("获取App问题反馈详情：{}", id);
        AppIssueFeedbackVo appIssueFeedbackVo = issueFeedbackService.getAppIssueFeedbackById(id);
        return ApiResult.success(appIssueFeedbackVo);
    }

    /**
     * 获取App问题反馈分页列表
     *
     * query
     * @return
     * @throws Exception
     */
    @Operation(summary = "获取App问题反馈分页列表")
    @PostMapping("/getAppIssueFeedbackPage")
    public ApiResult<AppIssueFeedbackVo> getAppIssueFeedbackPage(@Valid @RequestBody AppIssueFeedbackQuery query) {
        log.info("获取App问题反馈分页列表：{}", query);
        Paging<AppIssueFeedbackVo> paging = issueFeedbackService.getAppIssueFeedbackPage(query);
        return ApiResult.success(paging);
    }

}
